<?php

class MY_Controller extends CI_Controller {

    var $_data = FALSE;
    var $container = 'container';

    public function __construct() {
        parent::__construct();

        $this->load->library('pagination');
        $this->load->library('session');
        $this->load->library('form_validation');
        $this->load->helper('language');
        $this->load->helper('text');
        $this->load->model('Club_m');
        $this->load->model('Admin_m');
        $this->load->model('Media_m');
        $this->_data['media_category'] = $this->Media_m->get_media_category();
    }

    function display_view($path) {
        $this->before_render();
        $this->_data['load_path'] = $path;
        $this->load->view($this->container, $this->_data);
    }

    function display_admin($path) {
        $this->before_render();
        $this->_data['load_path'] = $path;
        $this->load->view('admin/container', $this->_data);
    }

    function before_render() {
        
    }

}

class FrontEnd_Controller extends MY_Controller {

    public function __construct() {
        parent::__construct();
        $header['page'] = 'home/header';
        $footer['page'] = "home/footer";
        $sidebar['page'] = "home/side_bar";
        $this->_data['sidebar'] = $sidebar;
        $this->_data['footer'] = $footer;
        $this->_data['header'] = $header;
        $this->load->Model('News_m');
        $this->load->Model('Media_m');
    }
    
    function display_view($path) {
        $this->before_render();
        $this->_data['load_path'] = $path;
        $this->load->view('home/container', $this->_data);
    }
    
    function before_render() {
                   
    }
  

}

class Home_Controller extends MY_Controller{
 	public function __construct() {
        parent::__construct();
        $header['page'] = 'home/home/header';
        $footer['page'] = "home/home/footer";
        $this->_data['footer'] = $footer;
        $this->_data['header'] = $header;
        $this->load->model("Media_m");
        $this->load->model("News_m");
        
        
    }
    
    function display_view($path) {
        $this->before_render();
        $this->_data['load_path'] = $path;
        $this->load->view('home/home/container', $this->_data);
    }
    
    function before_render() {
        $this->_data['home_images'] = $this->Media_m->get_home_images();
        $this->_data['home_news'] = $this->News_m->get_home_news();
        
    }	
}

class Media_Controller extends MY_Controller{
 	public function __construct() {
        parent::__construct();
        $header['page'] = 'home/gallerie/header';
        $footer['page'] = "home/gallerie/footer";
        $sidebar['page'] = "home/gallerie/side_bar";
        $this->_data['sidebar'] = $sidebar;
        $this->_data['footer'] = $footer;
        $this->_data['header'] = $header;
        $this->load->Model('Media_m');
        $this->load->model("Support_m");  
    }
    
    function display_view($path) {
        $this->before_render();
        $this->_data['load_path'] = $path;
        $this->load->view('home/gallerie/gallerie_container', $this->_data);
    }
    
    function before_render() {
        $this->_data['home_support'] = $this->Support_m->get_support_account();
        $this->_data['media_category'] = $this->Media_m->get_media_category();
    }	
}

class Contact_Controller extends MY_Controller{
 	public function __construct() {
        parent::__construct();
        $header['page'] = 'home/contact/header';
        $footer['page'] = "home/contact/footer";
        $sidebar['page'] = "home/contact/side_bar";
        $this->_data['sidebar'] = $sidebar;
        $this->_data['footer'] = $footer;
        $this->_data['header'] = $header;
        $this->load->model("Contact_m");
    }
    
    function display_view($path) {
        $this->before_render();
        $this->_data['load_path'] = $path;
        $this->load->view('home/contact/container', $this->_data);
    }
    
    function before_render() {
        $this->_data['contact_information'] = $this->Contact_m->get_contact_information();
        $this->_data['contact'] = $this->Contact_m->get_all_contact();
    }	
}

class Admin_Controller extends MY_Controller {

    public function __construct() {
        parent::__construct();
        $header['page'] = 'admin/header';
        $footer['page'] = "admin/footer";
        $this->_data['footer'] = $footer;
        $this->_data['header'] = $header;
    }

    function before_render() {
       
    }

}

class News_Controller extends FrontEnd_Controller{
    
    public function __construct(){
        parent :: __construct();
        $sidebar['page'] = "home/news/news_sidebar";
        $this->_data['sidebar'] = $sidebar;
        $this->load->Model('News_m');
        
        
    }
    
    function display_view($path) {
        $this->before_render();
        $this->_data['load_path'] = $path;
        $this->load->view('home/news/news_container', $this->_data);
    }
    
    function before_render() {
        $this->_data['categories'] = $this->News_m->get_categories_home();
    }
}


class Gallerie_Controller extends FrontEnd_Controller{
    
    public function __construct(){
        parent :: __construct();
        $sidebar['page'] = "home/gallerie/gallerie_sidebar";
        $this->_data['sidebar'] = $sidebar;
        $this->load->Model('Media_m');
        
    }
    
    function display_view($path) {
        $this->before_render();
        $this->_data['load_path'] = $path;
        $this->load->view('home/gallerie/gallerie_container', $this->_data);
    }
    
    function before_render() {
        //$this->_data['cat_list'] = $this->Club_m->get_club_categories();
        
    }
}

?>